package com.gt.quality.system.controller;


import com.gt.quality.base.BaseCommonController;
import com.gt.quality.base.BaseCommonService;
import com.gt.quality.base.pojo.LayerListViewObject;
import com.gt.quality.base.pojo.Resp;
import com.gt.quality.system.entity.SysDictType;
import com.gt.quality.system.service.SysDictTypeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 字典类型表(SysDictType)表控制层
 *
 * @author makejava
 * @since 2026-12-26 11:20:03
 */
@RestController
@RequestMapping("sysDictType")
@Tag(name = "数据字典类型")
public class SysDictTypeController extends BaseCommonController<SysDictType> {

    /**
     * 服务对象
     */
    private SysDictTypeService sysDictTypeService;


    /**
     * 分页查询数据
     *
     * @return 所有数据
     */
    @PostMapping("/queryLaySelectTree")
    @Operation(summary = "数据字典树")
    public Resp<LayerListViewObject> queryLaySelectTree() {
        LayerListViewObject data = sysDictTypeService.buildTree();
        return Resp.ok(data);
    }

    @Override
    protected Long getTreeId(SysDictType item) {
        return item.getDictId();
    }

    @Override
    protected Long getTreeParentId(SysDictType item) {
        return item.getParentDictId();
    }

    @Override
    protected String getTreeShowName(SysDictType item) {
        return item.getDictName();
    }

    @Autowired
    public void setSysDictTypeService(SysDictTypeService service) {
        this.sysDictTypeService = service;
    }

    @Override
    public BaseCommonService<SysDictType> getThisService() {
        return sysDictTypeService;
    }

    @Override
    protected boolean isSuperExcel() {
        return true;
    }
}
